<form action="index.php/payment_record/update/" method="post" name="myform" id="myform">
<div id="inline5">
<h2><span>详细信息</span></h2>
<table>
        <tr><th colspan="5">回款记录：</th></tr>
        <tr>
            <td class="name" width="100"><span>*</span>客户：</td>
            <td colspan="4"><input id="customer_name" autocomplete="off" style="" type="text" name="customer_name" value=<?= $payment_record->customer_name?>></input></td>
        </tr>
        <tr>
        	<td class="name" width="100">合同/订单：</td>
            <td colspan="4">
				<select id="plan_contacter_name" name="contract_id" style=" width:275px;">
						<option value="<?= $payment_record->contract_id?>"><?= $payment_record->contract_subject?></option>
                </select>
            </td>
        </tr>
        <tr>
            <td class="name" width="100">期次：</td>
            <td>
            	<select name="stages">
            	    <?php //for($i=1;$i<=12;$i++){?>
                	<option value="<?= $payment_record->stages?>"><?= $payment_record->stages?></option>
                    <?php //}?>
                </select>
            </td>
        </tr>
        <tr>
            <td class="name" width="100">日期：</td>
            <td><input name="payment_time" type="text" class="datepicker" id="find_time"  style="background:url(images/calendar.gif) right 1px no-repeat;" value=<?= $payment_record->payment_time?> ></input></td>
        </tr>

        <tr>
            <td class="name" width="100">金额：</td>
            <td><input class="input_bg" name="money" type="text" id="principal" value=<?= $payment_record->money?> ></input></td>
        </tr>
        <tr>
            <td class="name" width="100">以开发票：</td>
            <td>
            	<select name="bill">
                	<option value="1" <?php if($payment_record->bill == '1'):?>selected="selected"<?php endif;?>>是</option>
                    <option value="0" <?php if($payment_record->bill == '0'):?>selected="selected"<?php endif;?>>否</option>
                    <option value="-1" <?php if($payment_record->bill == '-1'):?>selected="selected"<?php endif;?>>无需开票</option>
                </select>
            </td>
        </tr>
        <tr>
            <td class="name" width="100">付款方式：</td>
            <td>
            	<select name="payment_method">
                	<option value="支票" <?php if($payment_record->payment_method == '支票'):?>selected="selected"<?php endif;?>>支票</option>
                    <option value="现金" <?php if($payment_record->payment_method == '现金'):?>selected="selected"<?php endif;?>>现金</option>
                    <option value="银行转帐" <?php if($payment_record->payment_method == '银行转帐'):?>selected="selected"<?php endif;?>>银行转帐</option>
                    <option value="其它" <?php if($payment_record->payment_method == '其它'):?>selected="selected"<?php endif;?>>其它</option>
                </select>
            </td>
        </tr>
        <tr>
            <td class="name" width="100">所有者：</td>
            <td>
            	<select name="owner_id" style=" width:275px;">
                	<?php foreach($users as $user):?>
                	<?php if($user->user_name != '何俊斌'):?>
                		<option <?php if($payment_record->owner_id == $user->id):?>selected="selected"<?php endif;?> value="<?= $user->id?>"><?= $user->user_name?></option>
                	<?php endif;?>
                	<?php endforeach;?>
                </select>
            </td>
        </tr>
        <tr>
            <td class="name" width="100">备注：</td>
            <td>
            	<textarea name="remark"><?= $payment_record->remark?></textarea>
            </td>
        </tr>
        <tr><td>&nbsp;</td></tr>
        <tr class="sub">
            <td colspan="5"><input type="button" id="record_tijiao" value="提交" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset""重置" /></td>
        </tr>
    </table>
</div>
<input type="hidden" name="record_id" value=<?= $payment_record->id?>></input>
<input type="hidden" name="create_time" value="<?= $payment_record->create_time?>"></input>
</form>
<input type="hidden" id="type" value="2" ></input>
<script type="text/javascript">
	$(function(){
		$("#record_tijiao").click(function(){
			var customer_name = $("#customer_name").val();
			if(!customer_name){
				alert('客户名不允许为空');
			}else{
				var plan_contacter_name = $("#plan_contacter_name").val();
				var principal = $("#principal").val();
				var record_id = $(":input[name='record_id']").val();
				$.post("index.php/payment_record/check_payment_money", { contarct_id: plan_contacter_name,money: principal,already_id: record_id},
						   function(data){
						    if(data){
							    alert('回款金额输入过大');
							    $("#principal").focus();
							    }else{
							    	$("#myform").submit();
								}
				});
			}
		})
	})
</script>
<script type="text/javascript">
$(function() {
		$( ".datepicker" ).datepicker();
});
</script>